package com.wx.chapter10.codeblock_;

/**
 * ClassName:CodeBlock01
 * Package :com.wx.chapter10.codeblock_
 * Description :
 *
 * @Author : coder_mu
 * @Create : 2023/6/3 - 14:12
 */
public class CodeBlock01 {
    public static void main(String[] args) {
        Movies movie1 = new Movies("你好");
        System.out.println("===============");
        Movies movie2 = new Movies("唐探 3", 100, "陈思诚");
    }
}


class Movies {
    private String name;
    private double price;
    private String director;

    {//代码块的优先级高于构造器，每使用构造器都会先执行代码块中的语句
        System.out.println("电影屏幕打开...");
        System.out.println("广告开始...");
        System.out.println("电影正是开始...");
    }

    ;

    public Movies(String name) {
        this.name = name;
        System.out.println("Movie(String name)  被调用...");
    }

    public Movies(String name, double price, String director) {
        this.name = name;
        this.price = price;
        this.director = director;
        System.out.println("Movie(String name, double price, String director)  被调用...");
    }
}